---
title: PreferenceService
summary: Contract detail for PreferenceService, hosted at the `PreferenceService` route.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-22
---

# PreferenceService

`PreferenceService` implements the external `IPreferenceService` contract and is activated over the `PreferenceService` route. This page documents every public operation the class exposes.

| Field | Value |
| --- | --- |
| **Service class** | `SAIF.Services.WCF.Services.PreferenceService` |
| **Declared contract** | `IPreferenceService` — external (`SAIF.Services.WCF.Contracts`, arriving transitively via `SAIF.Framework.Core`) * |
| **Route** | `PreferenceService` |
| **Source** | `src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs` |
| **Service attributes** | `[AspNetCompatibilityRequirements(RequirementsMode = Allowed)]`, `[LogErrorBehavior]` |
| **Instancing / concurrency** | WCF defaults — not overridden in source |
| **Binding** | `basicHttpBinding` (default, unnamed — no `<endpoint>` is configured for any of the six routes) |
| **Class-level authorization** | None in code |
| **Error handling** | `[LogErrorBehavior]` installs `ErrorLogErrorHandler`; see [Faults and error pipeline](../faults.md) |
| **Operations** | 3 |
| **Also hosted in** | — |

---

## GetPreferences

Retrieve a stored preference set.

| Field | Value |
| --- | --- |
| **Operation name** | `GetPreferences` |
| **Contract name** | `GetPreferences` — override, if any, not observable because `IPreferenceService` is declared in an external contracts assembly |
| **SOAP action** | Not observable — contract assembly is external |
| **Implementing member** | `SAIF.Services.WCF.Services.PreferenceService.GetPreferences` (`src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs`) |
| **Pattern** | Request/response (`IsOneWay` not observable — contract assembly is external) |
| **Binding** | `basicHttpBinding` (default, unnamed) |
| **Authorization** | [None in code](../authentication-authorization.md#authorization-enforcement) |
| **Process** | [OP-006](../operations/preference-getpreferences.md) |

### GetPreferences input message

| Part | Type | Required | Default | Purpose |
| --- | --- | --- | --- | --- |
| `applicationName` | `string` | Yes | — | Application name portion of the preference key; lower-cased before matching. |
| `pageName` | `string` | No | — | Page name portion of the preference key; a blank value is normalized to the empty string. |
| `user` | `string` | Yes | — | User portion of the preference key; lower-cased before matching. |

### GetPreferences output message

| Field | Value |
| --- | --- |
| **Return type** | `IDictionary<string, string>` |
| **Meaning** | The stored preference set for the application/page/user combination. |
| **Empty-result behavior** | An empty `Dictionary<string, string>` when no matching record exists. |

### GetPreferences faults

| Fault | Declared | Raised when | Surfaced as | Detail crosses the boundary |
| --- | --- | --- | --- | --- |
| Oracle/NHibernate exception | Not declared | See [OP-006 process detail](../operations/preference-getpreferences.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |
| JSON deserialization failure of `PreferenceText` | Not declared | See [OP-006 process detail](../operations/preference-getpreferences.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |

<!-- No `[FaultContract]` is declared on any operation in this host — see Faults and error pipeline. -->

### GetPreferences authorization

None in code. Access to `GetPreferences` rests entirely on the IIS authentication configured for the deployment variant; see [Authentication and authorization](../authentication-authorization.md#authorization-enforcement).

### GetPreferences side effects

| Aspect | Finding |
| --- | --- |
| Records written | `Preference` (read only) |
| Downstream calls | None |
| Files or messages produced | None — read-only |
| Shared state touched | None |
| Repeat-call behavior | Idempotent read |

---

## SavePreferences

Insert, update, or delete a stored preference set.

| Field | Value |
| --- | --- |
| **Operation name** | `SavePreferences` |
| **Contract name** | `SavePreferences` — override, if any, not observable because `IPreferenceService` is declared in an external contracts assembly |
| **SOAP action** | Not observable — contract assembly is external |
| **Implementing member** | `SAIF.Services.WCF.Services.PreferenceService.SavePreferences` (`src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs`) |
| **Pattern** | Request/response (`IsOneWay` not observable — contract assembly is external) |
| **Binding** | `basicHttpBinding` (default, unnamed) |
| **Authorization** | [None in code](../authentication-authorization.md#authorization-enforcement) |
| **Process** | [OP-007](../operations/preference-savepreferences.md) |

### SavePreferences input message

| Part | Type | Required | Default | Purpose |
| --- | --- | --- | --- | --- |
| `applicationName` | `string` | Yes | — | Application name portion of the preference key; lower-cased before matching. |
| `pageName` | `string` | No | — | Page name portion of the preference key; a blank value is normalized to the empty string. |
| `user` | `string` | Yes | — | User whose preferences are written; lower-cased before matching. |
| `preferences` | `IDictionary<string, string>` | Yes | — | The preference set to persist; an empty dictionary triggers deletion of an existing record. |
| `currentUser` | `string` | Yes | — | Unverified caller-supplied audit value; presence-checked but not authenticated. |

### SavePreferences output message

| Field | Value |
| --- | --- |
| **Return type** | void |
| **Meaning** | A successful response indicates only that the operation completed without a fault. |
| **Empty-result behavior** | Not applicable. |

### SavePreferences faults

| Fault | Declared | Raised when | Surfaced as | Detail crosses the boundary |
| --- | --- | --- | --- | --- |
| `ArgumentNullException` (missing `currentUser`) | Not declared | See [OP-007 process detail](../operations/preference-savepreferences.md) | Generic SOAP fault produced by The operation itself, via `Enforce` | Yes |
| Oracle/NHibernate exception during commit | Not declared | See [OP-007 process detail](../operations/preference-savepreferences.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |

<!-- No `[FaultContract]` is declared on any operation in this host — see Faults and error pipeline. -->

### SavePreferences authorization

None in code. Access to `SavePreferences` rests entirely on the IIS authentication configured for the deployment variant; see [Authentication and authorization](../authentication-authorization.md#authorization-enforcement).

### SavePreferences side effects

| Aspect | Finding |
| --- | --- |
| Records written | `Preference` (insert, update, or delete) |
| Downstream calls | None |
| Files or messages produced | Writes, updates, or deletes one `Preference` row |
| Shared state touched | None |
| Repeat-call behavior | Re-running with the same arguments reaches the same terminal state (upsert-like) |

---

## GetDefaultPrinter

Resolve a user's default printer from Active Directory.

| Field | Value |
| --- | --- |
| **Operation name** | `GetDefaultPrinter` |
| **Contract name** | `GetDefaultPrinter` — override, if any, not observable because `IPreferenceService` is declared in an external contracts assembly |
| **SOAP action** | Not observable — contract assembly is external |
| **Implementing member** | `SAIF.Services.WCF.Services.PreferenceService.GetDefaultPrinter` (`src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs`) |
| **Pattern** | Request/response (`IsOneWay` not observable — contract assembly is external) |
| **Binding** | `basicHttpBinding` (default, unnamed) |
| **Authorization** | [None in code](../authentication-authorization.md#authorization-enforcement) |
| **Process** | [OP-008](../operations/preference-getdefaultprinter.md) |

### GetDefaultPrinter input message

| Part | Type | Required | Default | Purpose |
| --- | --- | --- | --- | --- |
| `user` | `string` | Yes | — | User whose default printer is requested. |

### GetDefaultPrinter output message

| Field | Value |
| --- | --- |
| **Return type** | `string` |
| **Meaning** | The AD `extensionAttribute2` value for the SAIF-domain principal matching `user`. |
| **Empty-result behavior** | `string.Empty` when the user is unknown or the attribute is unset. |

### GetDefaultPrinter faults

| Fault | Declared | Raised when | Surfaced as | Detail crosses the boundary |
| --- | --- | --- | --- | --- |
| Directory exception | Not declared | See [OP-008 process detail](../operations/preference-getdefaultprinter.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |

<!-- No `[FaultContract]` is declared on any operation in this host — see Faults and error pipeline. -->

### GetDefaultPrinter authorization

None in code. Access to `GetDefaultPrinter` rests entirely on the IIS authentication configured for the deployment variant; see [Authentication and authorization](../authentication-authorization.md#authorization-enforcement).

### GetDefaultPrinter side effects

| Aspect | Finding |
| --- | --- |
| Records written | None |
| Downstream calls | Active Directory (`SAIF` domain) |
| Files or messages produced | None — directory read only |
| Shared state touched | None |
| Repeat-call behavior | Idempotent read |


---

## Coverage checklist

| Public member | Documented section | Pattern |
| --- | --- | --- |
| `IDictionary<string, string> GetPreferences(string applicationName, string pageName, string user)` | [`GetPreferences`](#getpreferences) | Request/response |
| `void SavePreferences(string applicationName, string pageName, string user, IDictionary<string, string> preferences, string currentUser)` | [`SavePreferences`](#savepreferences) | Request/response |
| `string GetDefaultPrinter(string user)` | [`GetDefaultPrinter`](#getdefaultprinter) | Request/response |

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Architecture](../architecture.md)
- [Activation and hosting](../activation-hosting.md)
- [Operations](../operations.md)
- [Faults and error pipeline](../faults.md)
- [Authentication and authorization](../authentication-authorization.md)
- [Dependencies](../dependencies.md)
- [Configuration](../configuration.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Data model](../data-model.md)
- [Operational runbook](../operational-runbook.md)
- [Tech debt](../tech-debt.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- src/WCF/SAIF.Services.WCF.Host/Services/PreferenceService.cs
